# 指定基础镜像
FROM centos:7

# 拷贝jdk包和tomcat包
COPY jdk-15_linux-x64_bin.rpm /usr/local/src/
ADD apache-tomcat-9.0.38.tar.gz /usr/local/

# 安装jdk和tomcat
WORKDIR /usr/local/src
RUN yum -y localinstall jdk-15_linux-x64_bin.rpm && \
	mv /usr/local/apache-tomcat-9.0.38 /usr/local/tomcat && \
	rm -rf /usr/local/src/jdk-15_linux-x64_bin.rpm

# 设置环境变量
ENV JAVA_HOME=/usr/java/jdk-15
ENV CLASS_PATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib
ENV PATH=$JAVA_HOME/bin:$PATH
ENV CATALINA_HOME /usr/local/tomcat

# 设置开放端口，启动tomcat
WORKDIR /
EXPOSE 8080
CMD /usr/local/tomcat/bin/catalina.sh run
